<?php
$wpppo = WP_prettyPhoto::$opts;
if (count($_POST)) {
  foreach ($_POST as $k=>$v) {
    if (array_key_exists($k, $wpppo)) { update_option($k, $v); }
  }
  $wpppo = WP_prettyPhoto::_getOptions(array('values'=>true,'defaults'=>false));
}
?>
<script type="text/javascript" language="javascript">
function disableOthers(v) {
  if (v == true) {
    document.getElementById('wppp_automate_img').disabled=true;
    document.getElementById('wppp_automate_swf').disabled=true;
    document.getElementById('wppp_automate_mov').disabled=true;
    document.getElementById('wppp_automate_yt').disabled=true;
    document.getElementById('wppp_automate_ext').disabled=true;
  }
  else {
    document.getElementById('wppp_automate_img').disabled=false;
    document.getElementById('wppp_automate_swf').disabled=false;
    document.getElementById('wppp_automate_mov').disabled=false;
    document.getElementById('wppp_automate_yt').disabled=false;
    document.getElementById('wppp_automate_ext').disabled=false;
  }
}
</script>
<div class="wrap">
  <h2><?php _e('WP-prettyPhoto Options', 'wp-prettyphoto') ?></h2>
  <form name="wp-prettyphoto-options" method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>&updated=true">
    <table class="form-table optiontable editform">
      <tr valign="top">
        <th scope="row"><?php _e('Automatic Prettifying', 'wp-prettyphoto') ?></th>
        <td>
          <p>
            <input type="checkbox" id="wppp_automate_all" name="wppp_automate_all" value="1" <?php echo $wpppo['wppp_automate_all']? 'checked="checked"' : ''; ?> onchange="disableOthers(this.checked);"/><label for="wppp_automate_all">All supported formats</label><br />
            <input type="checkbox" id="wppp_automate_img" name="wppp_automate_img" value="1" <?php echo $wpppo['wppp_automate_img']? 'checked="checked"' : ''; ?> /><label for="wppp_automate_img">Image links (BMP, GIF, JPF, JPEG, PNG)</label><br />
            <input type="checkbox" id="wppp_automate_swf" name="wppp_automate_swf" value="1" <?php echo $wpppo['wppp_automate_swf']? 'checked="checked"' : ''; ?> /><label for="wppp_automate_swf">Flash video links (SWF)</label><br />
            <input type="checkbox" id="wppp_automate_mov" name="wppp_automate_mov" value="1" <?php echo $wpppo['wppp_automate_mov']? 'checked="checked"' : ''; ?> /><label for="wppp_automate_mov">Movie links (MOV)</label><br />
            <input type="checkbox" id="wppp_automate_yt" name="wppp_automate_yt" value="1" <?php echo $wpppo['wppp_automate_yt']? 'checked="checked"' : ''; ?> /><label for="wppp_automate_yt">YouTube links</label><br />
            <input type="checkbox" id="wppp_automate_ext" name="wppp_automate_ext" value="1" <?php echo $wpppo['wppp_automate_ext']? 'checked="checked"' : ''; ?> /><label for="wppp_automate_ext">External links (iFrame)</label>
          </p>
        </td>
      </tr>
      <tr valign="top">
        <th scope="row"><?php _e('prettyPhoto Theme', 'wp-prettyphoto') ?></th>
        <td>
          <p>
            <label for="wppp_theme"><?php _e('Below is a list of the prettyPhoto themes you have installed. To learn more about themeing prettyPhoto, refer to the <a href="http://blog.fusi0n.org/wp-prettyphoto/technical-information-and-usage-instructions#theming" target="_blank">documentation</a>.', 'wp-prettyphoto')?></label><br />
            <select name="wppp_theme" id="wppp_theme">
            <?php
            $wppp_theme_list = WP_prettyPhoto::_getThemes();
            foreach ($wppp_theme_list as $theme):
            ?>
              <option value="<?php echo $theme?>" <?php echo $wpppo['wppp_theme'] == $theme? 'selected="selected"' : ''?>><?php echo ucfirst($theme)?></option>
            <?php endforeach; ?>
            </select>
          </p>
          <p>
            <select name="wppp_speed" id="wppp_speed">
              <option value="fast" <?php echo $wpppo['wppp_speed'] == 'fast'? 'selected="selected"' : ''?>>Fast</option>
              <option value="slow" <?php echo $wpppo['wppp_speed'] == 'slow'? 'selected="selected"' : ''?>>Slow</option>
              <option value="normal" <?php echo $wpppo['wppp_speed'] == 'normal'? 'selected="selected"' : ''?>>Normal</option>
            </select>
            <label for="wppp_speed"><?php _e('The speed at which the prettyPhoto box should open.', 'wp-prettyphoto')?></label>
          </p>
          <p>
            <input type="text" id="wppp_padding" name="wppp_padding" value="<?php echo $wpppo['wppp_padding']?>" size="3" />
            <label for="wppp_padding"><?php _e("Padding on each side of the displayed element inside prettyPhoto's box. Percentage values only (0-100).", 'wp-prettyphoto')?></label>
          </p>
          <p>
            <input type="text" id="wppp_opacity" name="wppp_opacity" maxlength="4" value="<?php echo $wpppo['wppp_opacity']?>" size="3" />
            <label for="wppp_opacity"><?php _e("Opacity of prettyPhoto's box. Float values between 0.<em>N</em> and 1.0.", 'wp-prettyphoto')?></label>
          </p>
          <p>
            <input type="text" id="wppp_counterlabel" name="wppp_counterlabel" value="<?php echo $wpppo['wppp_counterlabel']?>" size="3"/>
            <label for="wppp_counterlabel"><?php _e('String value of the separator character for galleries (eg 1<u><strong>/</strong></u>9, 1<u><strong> of </strong></u>9).', 'wp-prettyphoto')?></label>
          </p>
          <p>
            <input type="checkbox" id="wppp_title" name="wppp_title" value="1" <?php echo $wpppo['wppp_title']? 'checked="checked"' : ''; ?> />
            <label for="wppp_title"><?php _e("Show title (value of the element's ALT attribute) inside prettyPhoto box.", 'wp-prettyphoto')?></label>
          </p>
          <p>
            <input type="checkbox" id="wppp_resize" name="wppp_resize" value="1" <?php echo $wpppo['wppp_resize']? 'checked="checked"' : ''; ?> />
            <label for="wppp_resize"><?php _e('Allow the prettyPhoto box to be resizeable.', 'wp-prettyphoto')?></label>
          </p>
        </td>
      </tr>
      <tr valign="top">
        <th scope="row"><?php _e('Technical', 'wp-prettyphoto') ?></th>
        <td>
          <p>
            <input type="text" id="wppp_rel" name="wppp_rel" value="<?php echo $wpppo['wppp_rel']?>" size="15" />
            <label for="wppp_rel"><?php _e("prettyPhoto's REL attribute. prettyPhoto will only hook itself on elements with this REL attribute.", 'wp-prettyphoto')?></label>
          </p>
          <p>
            <input type="checkbox" id="wppp_jsreplace" name="wppp_jsreplace" value="1" <?php echo $wpppo['wppp_jsreplace']? 'checked="checked"' : ''; ?> />
            <label for="wppp_jsreplace"><?php _e('prettyPhoto requires jQuery >= 1.3.1. This script by default substitutes the correct jQuery version. Enable this if you have hardcoded a jQuery inclusion.', 'wp-prettyphoto')?></label>
          </p>
        </td>
      </tr>
    </table>
    <p class="submit"><input type="submit" id="submit" name="submit" value="<?php _e('Save Changes', 'wp-prettyphoto') ?>" /></p>
  </form>
</div>